package com.heima.user.task;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

@Component
public class ShardingJob {
    @XxlJob("shardingJob")
    public ReturnT<String> shardingJob(){
        System.err.println("任务执行了");
        int shardTotal = XxlJobHelper.getShardTotal();
        int shardIndex = XxlJobHelper.getShardIndex();
        System.err.println("总分片量"+shardTotal);
        System.err.println("当前分片索引"+shardIndex);
        return ReturnT.SUCCESS;
    }
}
